<!--小额/网银净额清算通知查询页面-->
<template>
  <div class="app-container">
    <ht-search-form
      v-show="showSearch"
      :dictMap="dictMap"
      :queryParams="queryParams"
      :outputQueryParams="queryParams"
      :formOptions="formOptions"
      :advOptions="[]"
    ></ht-search-form>
    <ht-table
      ref="dataTable"
      :showSerialNumber="false"
      :multi-select="false"
      :dictMap="dictMap"
      :reqConfig="reqConfig"
      :queryParams="queryParams"
      :tableBindColumns="tableBindColumns"
      :opButtonList="opButtonList"
    >
      <template v-slot:operate>
        <el-table-column label="操作" align="center" width="120" fixed="right" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <ht-button-group
              :buttonList="[
                {
                  label: '明细',
                  // permission: 'user:xxx:xxx',
                  doFunc: () => {
                    handleAction('detials', scope.row);
                  },
                },
              ]"
            />
          </template>
        </el-table-column>
      </template>
    </ht-table>
    <!-- 明细弹出框 -->
    <beps-details ref="bepsDetailsDialog" :dictMap="dictMap" :formData.sync="formData"></beps-details>
  </div>
</template>
<script>
import { apiUrlConfig, detail } from "@/api/cnaps/saps/otherCommQuery/beps_online_query.js";
import BepsDetails from "./components/bepsDetails";
import { listPageMixin } from "@/libs/listPageMixin";
import { log } from "util";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";

export default {
  name: "bepsOnlineQuery",
  mixins: [listPageMixin],
  components: {
    BepsDetails,
  },
  data() {
    return {
      reqConfig: apiUrlConfig,
      total: 0,
      dataList: [],
      //数据字典
      searchFormDictList: ["CHECK_TYPE", "CREDITDEBITCODE", "SYSTEMCODE", "PKG_STATUS"],
      //  明细弹框数据
      // form表单字段
      formData: {},
      showSearch: true,
      // 查询参数
      queryParams: {
        zccc: "",
        workdate: "",
        workdate2: "",
        workdate11: "",
        workdate22: "",
      },
      formOptions: [],
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        { label: `系统流水号`, prop: "id", width: "170", sortable: false },
        {
          label: `CPG日期`,
          prop: "vdate",
          width: "100",
          sortable: false,
          type: "date",
        },
        {
          label: `工作日期`,
          prop: "workdate",
          width: "160",
          sortable: false,
          type: "date",
        },
        {
          label: `轧差日期`,
          prop: "entryChkDate",
          width: "100",
          sortable: false,
          type: "date",
        },
        {
          label: `轧差类型`,
          prop: "zclx",
          width: "170",
          sortable: false,
          dictCode: "CHECK_TYPE",
        },
        {
          label: `轧差场次`,
          prop: "zccc",
          width: "170",
          sortable: false,
        },
        {
          label: `清算行行号`,
          prop: "chkStBrno",
          width: "170",
          sortable: false,
        },
        {
          label: `借贷标识`,
          prop: "entryCdFlag",
          width: "170",
          sortable: false,
          dictCode: "CREDITDEBITCODE",
        },
        {
          label: `清算日期`,
          prop: "entryClrDate",
          width: "160",
          sortable: false,
          type: "date",
        },
        {
          label: `金额`,
          prop: "amount",
          width: "160",
          sortable: false,
          type: "price",
        },
        {
          label: `报文接收时间`,
          prop: "zssj",
          sortable: false,
          type: "date",
        },
      ],
    };
  },
  mounted() {
    this.formOptions = [
      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate",
          endTimeName: "workdate2",
        },
        defaultAttr: {
          label: "CPG日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "dates",
        nameObj: {
          startTimeName: "workdate11",
          endTimeName: "workdate22",
        },
        defaultAttr: {
          label: "工作日期",
          placeholder: ["请输入开始日期", "请输入结束日期"],
          format: "yyyy-MM-dd",
          valueFormat: "yyyyMMdd",
        },
      },
      {
        type: "input",
        prop: "zccc",
        defaultAttr: {
          label: "轧差场次",
          placeholder: "请输入轧差场次",
        },
      },
    ];
  },
  methods: {
    editComplete(state) {
      if (state == true) {
      }
    },
    handleAction(type, row = {}) {
      switch (type) {
        case "detials":
          // 明细信息
          detail({ id: row.id, ntfctnType: row.ntfctnType }).then((res) => {
            this.formData = _.clone(res.result);
            if (res.result.bepspayAmount) {
              this.$set(this.formData, "bepspayamount", res.result.bepspayAmount);
              this.$set(this.formData, "bepspayacc", res.result.bepspayAcc);
              this.$set(this.formData, "hvpspayacc", res.result.hvpsPayAcc);
              this.$set(this.formData, "hvpspayamount", res.result.hvpspayAmount);
              this.$set(this.formData, "settleMentacc", res.result.settleMentAcc);
              this.$set(this.formData, "settlementAmount", res.result.settleMentAmount);
            }

            this.$refs.bepsDetailsDialog.show();
          });

          break;
      }
    },
  },
};
</script>
<style>
.label-header-msg {
  font-weight: bold;
}
</style>
